<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
		    
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">系统公告</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="sysmsgForm" method="post">
						<input type="hidden" id="id" name="id" th:value="${msg.id}"/>
						<div class="am-form-group">
							<label for="title" class="am-u-sm-1 am-form-label">文章标题：</label>
							<div class="am-u-sm-11">
								<input type="text" id="articleTitle" name="articleTitle" th:value="${msg.articleTitle}" class="tpl-form-input"  placeholder="最多50个字" maxlength="50" required="required" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="isTop" class="am-u-sm-1 am-form-label">是否置顶：</label>
							<div class="am-u-sm-11" style="line-height:2.4em;">
								<input type="hidden" id="order" name="order" th:value="${msg.order}"/>
							 	<input type="radio" class="tpl-form-input" name="orderCheck" th:checked="${msg.order}==1" value="1"  />&nbsp;是&nbsp;&nbsp;
                                <input type="radio" class="format-ctrl not-pie-item" name="orderCheck" th:checked="${msg.order}!=1" value="2" />&nbsp;否
							</div>
						</div>  
						<div class="am-form-group">
							<label for="sendType" class="am-u-sm-1 am-form-label">文章类型：</label>
							<div class="am-u-sm-11" style="line-height:2.4em;">
								<input type="hidden" id="articleType" name="articleType" th:value="${msg.articleType}"/>
                                 <input type="radio" class="tpl-form-input" name="sendType" th:checked="${msg.articleType}=='notice'" value="notice" />&nbsp;通知&nbsp;&nbsp;
                                 <input type="radio" class="format-ctrl not-pie-item" name="sendType" th:checked="${msg.articleType}=='company_new' or ${msg.articleType}==null" value="company_new" />&nbsp;公司动态
							</div>
						</div>  
						<div class="am-form-group">
							<label for="multiCheck" class="am-u-sm-1 am-form-label">发布栏目：</label>
							<div id="lanmu" class="am-u-sm-11" style="line-height:2.4em;">
								 <input type="hidden" id="scope" name="scope" th:value="${msg.scope}"/>
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m1" name="multiCheck" th:checked="${msg.scope}=='pc'" value="pc" />&nbsp;网站&nbsp;&nbsp;
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m2" name="multiCheck" th:checked="${msg.scope}=='sheng'" value="sheng" />&nbsp;来贷管家-省级&nbsp;&nbsp;
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m3" name="multiCheck" th:checked="${msg.scope}=='shi'" value="shi"/>&nbsp;来贷管家-地市级&nbsp;&nbsp;
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m4" name="multiCheck" th:checked="${msg.scope}=='xian'" value="xian"/>&nbsp;来贷管家-县级&nbsp;&nbsp;
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m5" name="multiCheck" th:checked="${msg.scope}=='zhen'" value="zhen"/>&nbsp;来贷管家-镇级&nbsp;&nbsp;
                                 <input type="checkbox" class="format-ctrl not-pie-item" id="m6" name="multiCheck" th:checked="${msg.scope}=='cun'" value="cun"/>&nbsp;来贷管家-村级
							</div>
						</div>  
   						<div class="am-form-group">
   							<label for="multiCheck" class="am-u-sm-1 am-form-label">文章内容：</label>
   							<div class="am-u-sm-11">
   								<input type="hidden" id="articleShort" name="articleShort" />
   								<!-- 加载编辑器的容器 start  -->
					    		<textarea id="articleContent" name="articleContent" th:text="${msg.articleContent}"></textarea>
   							</div>
   						</div>
					    <!-- 配置文件 -->
					    <script type="text/javascript" th:src="@{/plugins/ueditor/ueditor.config.js}"></script>
					    <!-- 编辑器源码文件 -->
					    <script type="text/javascript" th:src="@{/plugins/ueditor/ueditor.all.js}"></script>
					    <!-- 实例化编辑器 -->
					    <script type="text/javascript">
					        var ue = UE.getEditor('articleContent', {
							    toolbars: [
							        //['source', 'undo', 'redo','bold', 'italic', 'underline', 'removeformat', 'formatmatch', 'pasteplain', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', 'fontfamily', 'fontsize','imagenone', 'imageleft', 'imageright', 'imagecenter','simpleupload']
							    	[							    		
								        'source', //源代码
							    		//'anchor', //锚点
								        'undo', //撤销
								        'redo', //重做
								        'bold', //加粗
								        //'snapscreen', //截图
								        'italic', //斜体
								        'underline', //下划线
								        'strikethrough', //删除线
								        'subscript', //下标
								        'fontborder', //字符边框
								        'superscript', //上标
								        'formatmatch', //格式刷
								        'blockquote', //引用
								        'pasteplain', //纯文本粘贴模式
								        'selectall', //全选
								        //'print', //打印
								        //'preview', //预览
								        'horizontal', //分隔线
								        'removeformat', //清除格式
								        'cleardoc', //清空文档
								        //'time', //时间
								        //'date', //日期
								        'link', //超链接
								        'unlink', //取消链接
								        'inserttable', //插入表格
								        'deletetable', //删除表格
								        'insertrow', //前插入行
								        'insertcol', //前插入列
								        'mergeright', //右合并单元格
								        'mergedown', //下合并单元格
								        'deleterow', //删除行
								        'deletecol', //删除列
								        'splittorows', //拆分成行
								        'splittocols', //拆分成列
								        'splittocells', //完全拆分单元格
								        'deletecaption', //删除表格标题
								        'inserttitle', //插入标题
								        'mergecells', //合并多个单元格
								        'edittable', //表格属性
								        'edittd', //单元格属性
								        'insertparagraphbeforetable', //"表格前插入行"
								        //'insertcode', //代码语言
								        'fontfamily', //字体
								        'fontsize', //字号
								        //'paragraph', //段落格式
								        'simpleupload', //单图上传
								        //'insertimage', //多图上传
								        //'emotion', //表情
								        //'spechars', //特殊字符
								        //'searchreplace', //查询替换
								        //'map', //Baidu地图
								        //'gmap', //Google地图
								        //'insertvideo', //视频
								        //'help', //帮助
								        'justifyleft', //居左对齐
								        'justifyright', //居右对齐
								        'justifycenter', //居中对齐
								        'justifyjustify', //两端对齐
								        'forecolor', //字体颜色
								        'backcolor', //背景色
								        'insertorderedlist', //有序列表
								        'insertunorderedlist', //无序列表
								        //'fullscreen', //全屏
								        //'directionalityltr', //从左向右输入
								        //'directionalityrtl', //从右向左输入
								        'indent', //首行缩进
								        'lineheight', //行间距
								        'rowspacingtop', //段前距
								        'rowspacingbottom', //段后距
								        //'pagebreak', //分页
								        //'insertframe', //插入Iframe
								        'imagenone', //默认
								        'imageleft', //左浮动
								        'imageright', //右浮动
								        'imagecenter', //居中
								        //'attachment', //附件
								        'wordimage', //图片转存
								        'edittip ', //编辑提示
								        //'customstyle', //自定义标题
								        //'autotypeset', //自动排版
								        //'webapp', //百度应用
								        //'touppercase', //字母大写
								        //'tolowercase', //字母小写
								        //'background', //背景
								        //'template', //模板
								        //'scrawl', //涂鸦
								        //'music', //音乐
								        //'drafts', // 从草稿箱加载
								        //'charts', // 图表
							        ]
							    ],
							    autoHeightEnabled: true,
							    autoFloatEnabled: true,
							    initialFrameWidth : 853,
								initialFrameHeight: 600
							});
					    </script>
		    		 	<!-- 加载编辑器的容器 end -->
   					
						<div class="am-form-group">
							<div class="am-u-sm-1"></div>
							<div class="am-u-sm-11">
								<button type="button" onclick="javascript:$('#sysmsgForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
								<button type="button" onclick="loadPage('sysmsg/to_sysmsg')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
						
						
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
		
	var canSubmit = true;//表单重复提交控制 
	
	/* $("#isReceive,#bankId").selected(); */
	
	/* $(document).ready(function(){
		
		$('#startTime,#endTime').datetimepicker({
			format: 'yyyy-mm-dd hh:ii:ss',
			autoclose: true,
	        todayBtn: true,
			language:  'zh-CN'
		});
		
		var initImg = "<img src='" + $('#imageUrl').val() + "' class='file-preview-image'>";
		initUpFileOne('upFile','coverImg','选择图片',initImg);
		
		
		
	});
		
	
	function initUpFileOne(id,showId,label,initImg){
		$('#'+id+'').fileinput({
			 showUpload : true,
		     showRemove : false,
		     showCaption: false,
			 showPreview : true, //是否显示预览'
		     language : 'zh',
			 uploadUrl: 'banner/upload',
			 allowedPreviewTypes : [ 'image' ],
		     allowedFileExtensions : [ 'jpg', 'png', 'gif' ],
		     browseClass: "am-btn am-btn-danger am-btn-sm", //按钮样式
		     dropZoneEnabled: false,//是否显示拖拽区域
			 uploadAsync:false,
			 minImageWidth: 1125, //图片的最小宽度
             minImageHeight: 645,//图片的最小高度
             maxImageWidth: 1125,//图片的最大宽度
             maxImageHeight: 645,//图片的最大高度
             maxFileSize: 150,//单位为kb，如果为0表示不限制文件大小
			 uploadClass:'btn btn-default uploadBtnColor',
			 browseIcon:'<i class="am-icon-cloud-upload"></i>',
			 browseLabel:label,
			 removeIcon: '<i class="am-icon-trash"></i>',
			 layoutTemplates:{'footer':''},
			 initialPreview:initImg,
		}).on("filebatchuploadsuccess", function(event, data) {
		    if(data.response.ret==200){
		    	$('#imageUrl').val(data.response.content.info);
		    	layer.msg('上传成功', {
		    		  icon: 1,
		    		  time: 2000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    } else{
		    	layer.msg('服务器错误，请稍后重试~', {
		    		  icon: 3,
		    		  time: 3000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    }
		}); 
	} */

	validateUserForm();
	$(function(){
		var scope = $('#scope').val();
		if(scope){
			var arr = scope.split(",");
			for(i=0;i<arr.length;i++){
				$('input:checkbox[name="multiCheck"]').each(function(j){
					if(arr[i]==$(this).val()){
						$(this).attr("checked",'checked');
					}
		        });
			}
		}
		
	});
	
	function initHideParam(){
		$('#order').val($('input:radio[name="orderCheck"]:checked').val());
		$('#articleType').val($('input:radio[name="sendType"]:checked').val());
		var scope="";
		$('input:checkbox[name="multiCheck"]:checked').each(function(i){
			scope=scope+","+$(this).val();
        });
		if(scope)
		{
			scope = scope.substr(1);
			$('#scope').val(scope)
		}
		var content = ue.getPlainTxt().replace(/<img.*>/g,'');
		$('#articleShort').val(content.substring(0,10));
	}
	
    
	function validateUserForm(){  
		
		 $('#sysmsgForm').validate({
		        errorElement : 'span',
		        errorClass : 'am-icon-times',
		        focusInvalid : true,
		        onkeyup:false,
		        ignore : "",
		        rules : {
		        	
		        },
		        messages : {
		        	
		        },
		        submitHandler : function(form) {
		        	if(canSubmit){
		        		initHideParam();
		        		commit('sysmsgForm', 'sysmsg/saveMsg','sysmsg/to_sysmsg');
		        	}
		        	
		        }
		    });

	}
		]]>
	</script>